<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.bean.Guestbook" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/1
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
</head>
<body>
    <div class="container">
        <table class="table table-hover">
            <tr>
                <td>id</td>
                <td>name</td>
                <td>phone</td>
                <td>email</td>
                <td>title</td>
                <td>content</td>
                <td>createdtime</td>
                <td>操作</td>
            </tr>
            <%
                // Java代码部分
                // 从request中获取到list集合，然后遍历集合
                List<Object> list = (List<Object>) request.getAttribute("list");
                for (int i = 0;i<list.size();i++) {
                    Guestbook gb = (Guestbook) list.get(i);
            %>
                    <tr>
                        <td><%=gb.getId()%></td>
                        <td><%=gb.getName()%></td>
                        <td><%=gb.getPhone()%></td>
                        <td><%=gb.getEmail()%></td>
                        <td><%=gb.getTitle()%></td>
                        <td><%=gb.getContent()%></td>
                        <td><%=gb.getCreatedtime()%></td>
                        <td>
                            <a href="/UserManagerWeb_war_exploded/manager?q=into" class="btn btn-primary">添加</a>
                            <a href="/UserManagerWeb_war_exploded/manager?q=update&id=<%=gb.getId()%>" class="btn btn-warning">修改</a>
                            <a href="/UserManagerWeb_war_exploded/manager?q=delete&id=<%=gb.getId()%>" class="btn btn-danger">删除</a>
                        </td>
                    </tr>
            <%
                }
            %>
        </table>
    </div>
</body>
</html>
